package com.atguigu.lease.web.admin.config;

import com.atguigu.lease.common.converter.StringToBaseEnumConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@SpringBootConfiguration
public class MyWebMvcConFig implements WebMvcConfigurer {
    /**
     * 将转换器先挪过来个头
     * TODO:为什么？？？？
     */
    @Autowired
    private StringToBaseEnumConverter stringToBaseEnumConverter;


    //注册转换器的方法
    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverterFactory(stringToBaseEnumConverter);
    }
}
